
local cmdname = "aids_noclip"

local function NoclipHook( pl )
	
	if pl:GetNWInt( "AIDS_noclip", 2 ) != 2 then
		
		return tobool( pl:GetNWInt( "AIDS_noclip", 0 ) )
		
	end
	
end
	
AIDS.Hook( "PlayerNoClip", cmdname, NoclipHook )

if CLIENT then
	
	local args = { { Name = "Toggle On", Value = { "enabled", true } },
	{ Name = "Toggle Off", Value = { "disabled", false } } }
	
	AIDS.RegisterCommand( "Noclip", cmdname, "noclip", args ) 
	
else
	
	local function NoclipPlayer( ply, cmd, args )
	
		local target = AIDS.GetPlayer( args[1] )
		
		if target then
		
			local bool = tobool( args[3] )
			
			if bool then
		
				target:SetNWInt( "AIDS_noclip", 1 )
				
			else
			
				target:SetNWInt( "AIDS_noclip", 0 )
			
			end
	
			AIDS.ChatPrint( { ply, " " .. args[2] .. " ", target, "'s noclip abilities." } )
		
		end
	
	end
	
	
	
	AIDS.AddCommand( NoclipPlayer, cmdname )
	
end
